<?php
namespace app\helpers;

class Time
{
    private static $_starttime;
    private static $_endtime;

    public static function start()
    {
        self::$_starttime = explode(' ',microtime());
    }

    public static function end()
    {
        self::$_endtime = explode(' ',microtime());
    }

    public static function get()
    {
        $starttime = self::$_starttime;
        $endtime = self::$_endtime;
        $thistime = $endtime[0]+$endtime[1]-($starttime[0]+$starttime[1]);
        $thistime = round($thistime,3);
        return $thistime;
    }
}